package com.eureka.client;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: xuyanan
 * @date: 2021/5/7
 */
@RestController
public class Controller {

    @GetMapping("/getName")
    public String getName() {
        return "xyn";
    }

    @GetMapping("/getNiceName/{name}")
    public String getNiceName(@PathVariable("name") String name) throws InterruptedException {
        Thread.sleep(5000);
        return "NiceName => " + name;
    }

    @GetMapping("/timeoutMethod")
    public String timeoutMethod() {
        System.out.println("A: 进行系统超时方法的调用");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "A: xyn";
    }
}
